<!-- JSF Core tag library documentation
  -  Copyright (C) 2012, 2013, 2014 Stephane Carrez
  -  Written by Stephane Carrez (Stephane.Carrez@gmail.com)
  -
  -  Licensed under the Apache License, Version 2.0 (the "License");
  -  you may not use this file except in compliance with the License.
  -  You may obtain a copy of the License at
  -
  -      http://www.apache.org/licenses/LICENSE-2.0
  -
  -  Unless required by applicable law or agreed to in writing, software
  -  distributed under the License is distributed on an "AS IS" BASIS,
  -  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  -  See the License for the specific language governing permissions and
  -  limitations under the License.
  -->
<c:choose xmlns:c="http://java.sun.com/jstl/core"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:util="http://code.google.com/p/ada-asf/util">
    <!-- For security reasons, check that the code parameter matches what is allowed  -->
    <c:when test="#{empty param['code'] or param['code'] eq 'attribute'}">
        <util:script>
            Sample_Highlight('attribute', 'f:attribute');
            prettyPrint();
        </util:script>
        <code class="prettyprint lang-attribute linenums:1"><util:file src="/jsf/core/attribute.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'convertDateTime'}">
        <util:script>
            Sample_Highlight('convertDateTime','f:convertDateTime');
        </util:script>
        <code class="prettyprint lang-convertDateTime linenums:1"><util:file src="/jsf/core/convertDateTime.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'converter'}">
        <util:script>
            Sample_Highlight('converter','f:converter');
        </util:script>
        <code class="prettyprint lang-converter linenums:1"><util:file src="/jsf/core/converter.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'facet'}">
        <util:script>
            Sample_Highlight('facet','f:facet');
        </util:script>
        <code class="prettyprint lang-facet linenums:1"><util:file src="/jsf/core/facet.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'metadata'}">
        <util:script>
            Sample_Highlight('metadata','f:metadata');
        </util:script>
        <code class="prettyprint lang-metadata linenums:1"><util:file src="/jsf/core/metadata.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'param'}">
        <util:script>
            Sample_Highlight('param','f:param');
        </util:script>
        <code class="prettyprint lang-param linenums:1"><util:file src="/jsf/core/param.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'selectItem'}">
         <util:script>
             Sample_Highlight('selectItem','f:selectItem');
         </util:script>
         <code class="prettyprint lang-selectItem linenums:1"><util:file src="/jsf/core/selectItem.xhtml" escape="true"/>
         </code>
     </c:when>
    <c:when test="#{param['code'] eq 'selectItems'}">
        <util:script>
            Sample_Highlight('selectItems','f:selectItems');
        </util:script>
        <code class="prettyprint lang-selectItems linenums:1"><util:file src="/jsf/core/selectItems.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'validateLength'}">
        <util:script>
            Sample_Highlight('validateLength','f:validateLength');
        </util:script>
        <code class="prettyprint lang-validateLength linenums:1"><util:file src="/jsf/core/validateLength.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'validateLongRange'}">
        <util:script>
            Sample_Highlight('validateLongRange','f:validateLongRange');
        </util:script>
        <code class="prettyprint lang-validateLongRange linenums:1"><util:file src="/jsf/core/validateLongRange.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'validator'}">
        <util:script>
            Sample_Highlight('validator','f:validator');
        </util:script>
        <code class="prettyprint lang-validator linenums:1"><util:file src="/jsf/core/validator.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'view-example'}">
        <util:script>
            Sample_Highlight('view','f:view');
        </util:script>
        <code class="prettyprint lang-view linenums:1"><util:file src="/jsf/core/view-example.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'viewAction'}">
        <util:script>
            Sample_Highlight('viewAction','f:viewAction');
        </util:script>
        <code class="prettyprint lang-viewAction linenums:1"><util:file src="/jsf/core/viewAction.xhtml" escape="true"/>
        </code>
    </c:when>
    <c:when test="#{param['code'] eq 'viewParam'}">
        <util:script>
            Sample_Highlight('viewParam','f:viewParam');
        </util:script>
        <code class="prettyprint lang-viewParam linenums:1"><util:file src="/jsf/core/viewParam.xhtml" escape="true"/>
        </code>
    </c:when>

    <c:otherwise>
        <p>
            <h:outputFormat value="You have not selected the valid code: '{0}' is not recognized.">
                <f:param value="#{param['code']}"/>
            </h:outputFormat>
        </p>
    </c:otherwise>
</c:choose>